<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <form>
        <label for="stu_id">学号:</label>
        <input id="stu_id" type="text"><br>
        姓名:<input class="stu_name" type="text"><br>
        性别:<input class="stu_sex" type="text"><br>
        出生日期:<input class="stu_date" type="text"><br>
        爱好:<input class="stu_hobby" type="text"><br>
        男女朋友:<input class="stu_gbf" type="text"><br>
        头像:<input class="stu_head_img" type="text"><br>
        <button class="btn">提交学生信息</button>
    </form>
    <script src="./jquery/jquery-3.2.1.js"></script>
    <script>
        $('.btn').click((e) => {
            // console.log(1111)
            e.preventDefault();
            $.ajax({
                method:'post',
                url:'http://localhost:3000/student_info',
                data:{
                    stu_id:$('#stu_id').val(),
                    stu_name:$('.stu_name').val(),
                    stu_name:$('.stu_sex').val(),                      
                    stu_date:$('.stu_date').val(),
                    stu_hobby:$('.stu_hobby').val(),
                    stu_gbf:$('.stu_gbf').val(),
                    stu_gead_img:$('.stu_gead_img').val()
                },
                success:(data)=>{
                    console.log(data);
                },
                error:(err)=>{
                    console.log(err);
                }
            })
        })
    </script>
</body>

</html>